package com.rl.handler;

import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

//拦截器类：拦截用户的请求。
public class MyInterceptor implements HandlerInterceptor {


    //验证登录的用户信息， 正确return true，其它return false
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//        String userName = (String) request.getSession().getAttribute("userName");
//        String pwd = (String) request.getSession().getAttribute("pwd");
//        String flag = " ";
//
//
//        //判断登录的账户，是否符合要求
//        if (true){
//            request.setAttribute("flag",flag);
//            request.getRequestDispatcher("/index.jsp").forward(request,response);
//            return false;
//        }
        //登录
        return true;
    }


}
